<template>
	<view class="modelBox" @click="$util.redirectTo('/otherpages/activityDetali/activityDetali',{id:activeItem.id,type:type})">
		<view class="flex VisitorItemBox">
			<image class="w-220 h-220 bor-16 m-r-20" :src="$util.img(activeItem.image)" mode=""></image>
			<view class="h-220 flex_c w-400">
				<view class="font-32 font-weight">{{activeItem.title}}</view>
				<view class="font-24 grey">{{activeItem.application_num||0}}人报名</view>
				<view class="flex">
					<view class="wboxA m-r-10"></view>
					<view class="">{{$util.timeStampTurnTime(activeItem.start_time)}}</view>
				</view>
				<view class="flex">
					<view class="wboxB m-r-10"></view>
					<view class="wboxBTxt w-336">{{activeItem.address||''}}</view>
				</view>
			</view>
		</view>
			<view class="flex_b f-t m-t-20" v-if="type=='baoming'">
				<view class="f-t font-weight font-30">
					<text class="font-24">¥</text>
					{{activeItem.fee}}/
					<text class="font-24">位</text>
				</view>
				<view class="baomingBg" :class="activeItem.status=='已结束'?'activeEnd':''">{{activeItem.status=='已结束'?'已结束':'活动报名'}}</view>
			</view>
			<block v-else>
				<view v-if="activeItem.status=='已结束'" class="font-24 m-t-20 grey">已结束</view>
				<view v-else-if="activeItem.status=='未开始'" class="font-24 m-t-20 grey">距活动开始
				 <text class="f-t m-l-10">
					 <uv-count-down :time="sTime" format="HH:mm:ss"></uv-count-down>
				 </text>
				 </view>
				 <view v-else-if="activeItem.status=='进行中'" class="font-24 m-t-20 grey">距结束还剩
				  <text class="f-t m-l-10">
				 	 <uv-count-down :time="eTime" format="HH:mm:ss"></uv-count-down>
				  </text>
				  </view>
			</block>
	</view>
</template>

<script>
	export default {
		name: "activity",
		data() {
			return {
				
			};
		},
		props:['activeItem','type'],
		watch: {
			sTime() {
				var timestamp = Date.parse(new Date());
				let sTime = this.activeItem.start_time*1000
				return sTime-timestamp
			},
			eTime() {
				var timestamp = Date.parse(new Date());
				let eTime = this.activeItem.end_time*1000
				return eTime-timestamp
			},
		},
		methods:{
			
		}
	}
</script>

<style lang="scss">
	.activeEnd {
		background-color: #b5b5b3 !important;
		color: #000 !important;
	}
	.baomingBg {
		width: 160rpx;
		height: 64rpx;
		background: #EC6930;
		border-radius: 32rpx;
		font-size: 24rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		line-height: 64rpx;
	}
	.wboxA {
		width: 12rpx;
		height: 12rpx;
		background: #19c37b;
		border-radius: 50%;
	}

	.wboxB {
		width: 12rpx;
		height: 12rpx;
		background: #ff5e00;
		border-radius: 50%;
	}

	.wboxBTxt {
		/* 第一步：让文字强制一行显示 */
		white-space: nowrap;
		/* 第二步：溢出隐藏 */
		overflow: hidden;
		/* 第三步：溢出的内容省略号显示 */
		text-overflow: ellipsis;
	}

	.VisitorItemBox {
		image {
			width: 220rpx;
			height: 220rpx;
		}
	}
</style>
